<?php
//测试mysql抽象基类
//需要mysql.class.php支持
include"mysql.class.php";
class test extends mysql{
	protected $tablename="newstypes";
	function __construct(){
		parent::__construct();
	}
	function sel(){
		return $this->select();
	}
	function insert($arr){
		return $this->add($arr);
	}
	function delete(){
		return $this->del();
	}
	function update(){
		$post = array("typeName"=>'啊文');
		return $this->save($post);
	}
	function sqll(){
		$sql="select * from newstypes";
		return $this->sql($sql);
	}
	function link_a(){
		return "myLink";
	}
}
$ob=new test();

//测试调用：
$link_a = $ob->link_a();
var_dump($link_a);
echo "<br>mysql抽象基类,单利连接数据库";

//测试查询
//$arr=$ob->where("typeId=1")->sel();
//echo "<pre>";
//print_r($arr);
//echo "</pre>";

//测试添加
//echo "<hr>2";
//$post=array("typeId"=>"11","typeName"=>"技术");
//$re=$ob->insert($post);
//var_dump($re);

//测试修改
//echo "<hr>3";
//$res=$ob->where("typeId=11")->update();
//var_dump($res);

//测试删除
//echo "<hr>4";
//$re=$ob->where("typeId=11")->delete();
//var_dump($re);

//测试查询所有
//echo "<hr>5";
//$resql=$ob->sqll();
//echo "<pre>";
//print_r($resql);
//echo "</pre>";